﻿@page "/listgroups"

<h1>List Groups</h1>

<div class="docs-example">
    <BSListGroup>
        <BSListGroupItem>Cras justo odio</BSListGroupItem>
        <BSListGroupItem>Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem>Morbi leo risus</BSListGroupItem>
        <BSListGroupItem>Porta ac consectetur ac</BSListGroupItem>
        <BSListGroupItem>Vestibulum at eros</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups1.html" />

<h3>Active items</h3>

<div class="docs-example">
    <BSListGroup>
        <BSListGroupItem IsActive="true">Cras justo odio</BSListGroupItem>
        <BSListGroupItem>Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem>Morbi leo risus</BSListGroupItem>
        <BSListGroupItem>Porta ac consectetur ac</BSListGroupItem>
        <BSListGroupItem>Vestibulum at eros</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups2.html" />

<h3>Disabled items</h3>

<div class="docs-example">
    <BSListGroup>
        <BSListGroupItem IsDisabled="true">Cras justo odio</BSListGroupItem>
        <BSListGroupItem>Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem>Morbi leo risus</BSListGroupItem>
        <BSListGroupItem>Porta ac consectetur ac</BSListGroupItem>
        <BSListGroupItem>Vestibulum at eros</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups3.html" />

<h3>Links and buttons</h3>
<BSAlert Color=Color.Info>
    Currently it is necessary to set ListGroupType on both the group and the list. See: <a href="https://github.com/aspnet/Blazor/issues/650">https://github.com/aspnet/Blazor/issues/650</a>
</BSAlert>

<div class="docs-example">
    <BSListGroup ListGroupType="ListGroupType.Link">
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#" IsActive="true">Cras justo odio</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#">Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#">Morbi leo risus</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#">Porta ac consectetur ac</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#" IsDisabled="true">Vestibulum at eros</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups4.html" />

<div class="docs-example">
    <BSListGroup ListGroupType="ListGroupType.Button">
        <BSListGroupItem ListGroupType="ListGroupType.Button" IsActive="true">Cras justo odio</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Button">Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Button">Morbi leo risus</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Button">Porta ac consectetur ac</BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Button" IsDisabled="true">Vestibulum at eros</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups5.html" />

<h3>Supplying OnClick Handler</h3>
<div class="docs-example">
    <BSListGroup ListGroupType="ListGroupType.Button">
        <BSListGroupItem ListGroupType="ListGroupType.Button" OnClick="onclick">Click me</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups6.html" />

<h3>Flush</h3>
<div class="docs-example">
    <BSListGroup IsFlush="true">
        <BSListGroupItem>Cras justo odio</BSListGroupItem>
        <BSListGroupItem>Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem>Morbi leo risus</BSListGroupItem>
        <BSListGroupItem>Porta ac consectetur ac</BSListGroupItem>
        <BSListGroupItem>Vestibulum at eros</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups7.html" />

<h3>Contextual classes</h3>
<div class="docs-example">
    <BSListGroup>
        <BSListGroupItem>Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem Color="Color.Primary">A simple primary list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Secondary">A simple secondary list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Success">A simple success list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Danger">A simple danger list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Warning">A simple warning list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Info">A simple info list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Light">A simple light list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Dark">A simple dark list group item</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups8.html" />

<div class="docs-example">
    <BSListGroup ListGroupType="ListGroupType.Link">
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#">Dapibus ac facilisis in</BSListGroupItem>
        <BSListGroupItem Color="Color.Primary" ListGroupType="ListGroupType.Link" Href="#">A simple primary list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Secondary" ListGroupType="ListGroupType.Link" Href="#">A simple secondary list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Success" ListGroupType="ListGroupType.Link" Href="#">A simple success list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Danger" ListGroupType="ListGroupType.Link" Href="#">A simple danger list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Warning" ListGroupType="ListGroupType.Link" Href="#">A simple warning list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Info" ListGroupType="ListGroupType.Link" Href="#">A simple info list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Light" ListGroupType="ListGroupType.Link" Href="#">A simple light list group item</BSListGroupItem>
        <BSListGroupItem Color="Color.Dark" ListGroupType="ListGroupType.Link" Href="#">A simple dark list group item</BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups9.html" />

<h3>With badges</h3>
<BSAlert Color=Color.Info>
    For this to work right, a solution for adding custom classes needs to be added to BlazorStrap
</BSAlert>
<div class="docs-example">
    <BSListGroup>
        <BSListGroupItem>Cras justo odio <BSBadge IsPill="true">14</BSBadge></BSListGroupItem>
        <BSListGroupItem>Dapibus ac facilisis in <BSBadge IsPill="true">2</BSBadge></BSListGroupItem>
        <BSListGroupItem>Morbi leo risus <BSBadge IsPill="true">1</BSBadge></BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups10.html" />

<h3>Custom Content</h3>
<BSAlert Color=Color.Info>
    For this to work right, a solution for adding custom classes needs to be added to BlazorStrap
</BSAlert>

<div class="docs-example">
    <BSListGroup ListGroupType="ListGroupType.Link">
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#" IsActive="true">
            <BSListGroupItemHeading>
                <h5 class="mb-1">List group item heading</h5>
                <small>3 days ago</small>
            </BSListGroupItemHeading>
            <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
            <small>Donec id elit non mi porta.</small>
        </BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#">
            <BSListGroupItemHeading>
                <h5 class="mb-1">List group item heading</h5>
                <small class="text-muted">3 days ago</small>
            </BSListGroupItemHeading>
            <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
            <small class="text-muted">Donec id elit non mi porta.</small>
        </BSListGroupItem>
        <BSListGroupItem ListGroupType="ListGroupType.Link" Href="#">
            <BSListGroupItemHeading>
                <h5 class="mb-1">List group item heading</h5>
                <small class="text-muted">3 days ago</small>
            </BSListGroupItemHeading>
            <p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
            <small class="text-muted">Donec id elit non mi porta.</small>
        </BSListGroupItem>
    </BSListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups11.html" />

<h3>Using the List Group Data Template</h3>
<div class="docs-example">
    <BSDataListGroup Items="ListGroup" ListGroupType="ListGroupType.List" Context="groupItem">
        <ItemTemplate>
            <BSListGroupItem ListGroupType="ListGroupType.List" IsActive="@groupItem.IsActive" IsDisabled="@groupItem.IsDisabled">
                <BSListGroupItemHeading>
                    <h5 class="mb-1">@groupItem.Header</h5>
                    <small>@groupItem.LastEdited</small>
                </BSListGroupItemHeading>
                <p class="mb-1">@groupItem.Content</p>
                <small>@groupItem.FootNote</small>
            </BSListGroupItem>
        </ItemTemplate>        
    </BSDataListGroup>
</div>
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups13.html" />

<!-- <h3>Tabable Content</h3>
Review <div class="docs-example">
    <BSRow>
        <BSCol XS="4">
            <BSListGroup ListGroupType="ListGroupType.Link">
                <BSListGroupItem OnClick="onclick1" Class="@(active == 1 ? "active" : null)" ListGroupType="ListGroupType.Button">Home</BSListGroupItem>
                <BSListGroupItem OnClick="onclick2" Class="@(active == 2 ? "active" : null)" ListGroupType="ListGroupType.Button">Settings</BSListGroupItem>
                <BSListGroupItem OnClick="onclick3" Class="@(active == 3 ? "active" : null)" ListGroupType="ListGroupType.Button">Profile</BSListGroupItem>
                <BSListGroupItem OnClick="onclick4" Class="@(active == 4 ? "active" : null)" ListGroupType="ListGroupType.Button">Messages</BSListGroupItem>
            </BSListGroup>
        </BSCol>
        <BSCol XS="8">
            <BSTabContent>
                <BSTab></BSTab>
                <TabPane IsOpen="@(active == 1)">Velit aute mollit ipsum ad dolor consectetur nulla officia culpa adipisicing exercitation fugiat tempor. Voluptate deserunt sit sunt nisi aliqua fugiat proident ea ut. Mollit voluptate reprehenderit occaecat nisi ad non minim tempor sunt voluptate consectetur exercitation id ut nulla. Ea et fugiat aliquip nostrud sunt incididunt consectetur culpa aliquip eiusmod dolor. Anim ad Lorem aliqua in cupidatat nisi enim eu nostrud do aliquip veniam minim.</TabPane>
                <TabPane IsOpen="@(active == 2)">Cupidatat quis ad sint excepteur laborum in esse qui. Et excepteur consectetur ex nisi eu do cillum ad laborum. Mollit et eu officia dolore sunt Lorem culpa qui commodo velit ex amet id ex. Officia anim incididunt laboris deserunt anim aute dolor incididunt veniam aute dolore do exercitation. Dolor nisi culpa ex ad irure in elit eu dolore. Ad laboris ipsum reprehenderit irure non commodo enim culpa commodo veniam incididunt veniam ad.</TabPane>
                <TabPane IsOpen="@(active == 3)">Ut ut do pariatur aliquip aliqua aliquip exercitation do nostrud commodo reprehenderit aute ipsum voluptate. Irure Lorem et laboris nostrud amet cupidatat cupidatat anim do ut velit mollit consequat enim tempor. Consectetur est minim nostrud nostrud consectetur irure labore voluptate irure. Ipsum id Lorem sit sint voluptate est pariatur eu ad cupidatat et deserunt culpa sit eiusmod deserunt. Consectetur et fugiat anim do eiusmod aliquip nulla laborum elit adipisicing pariatur cillum.</TabPane>
                <TabPane IsOpen="@(active == 4)">Irure enim occaecat labore sit qui aliquip reprehenderit amet velit. Deserunt ullamco ex elit nostrud ut dolore nisi officia magna sit occaecat laboris sunt dolor. Nisi eu minim cillum occaecat aute est cupidatat aliqua labore aute occaecat ea aliquip sunt amet. Aute mollit dolor ut exercitation irure commodo non amet consectetur quis amet culpa. Quis ullamco nisi amet qui aute irure eu. Magna labore dolor quis ex labore id nostrud deserunt dolor eiusmod eu pariatur culpa mollit in irure.</TabPane>
            </BSTabContent>
        </BSCol>
    </BSRow>
</div>-
<PrettyCode CodeFile="_content/SampleCore/snippets/listgroups/listgroups12.html" />-->

@code {
            List<Item> ListGroup = new List<Item>
    {
        new Item
        {
            Header = "List group item heading Active",
            LastEdited = "3 days ago",
            Content = "Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.",
            FootNote = "Donec id elit non mi porta.",
            IsActive = true
        },
        new Item
        {
            Header = "List group item heading",
            LastEdited = "5 days ago",
            Content = "Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.",
            FootNote = "Donec id elit non mi porta.",
            IsActive = false
        },
        new Item
        {
            Header = "List group item heading Disabled",
            LastEdited = "5 days ago",
            Content = "Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.",
            FootNote = "Donec id elit non mi porta.",
            IsActive = false,
            IsDisabled = true
        }
    };

    void onclick(MouseEventArgs e)
    {
        Console.WriteLine("Button was clicked!");
    }

    private int active = 1;
    void onclick1(MouseEventArgs e)
    {
        active = 1;
        StateHasChanged();
    }

    void onclick2(MouseEventArgs e)
    {
        active = 2;
        StateHasChanged();
    }

    void onclick3(MouseEventArgs e)
    {
        active = 3;
        StateHasChanged();
    }

    void onclick4(MouseEventArgs e)
    {
        active = 4;
        StateHasChanged();
    }

    class Item
    {
        public string Header { get; set; }
        public string LastEdited { get; set; }
        public string Content { get; set; }
        public string FootNote { get; set; }
        public bool IsActive { get; set; } = false;
        public bool IsDisabled { get; set; } = false;
    }
}
